package com.eric.api.feign;

import com.eric.api.dto.AccountDto;
import entity.CommonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @author:Eric
 * @date:2021/7/7
 */
@FeignClient(name = "account-service")
public interface AccountFeign {

    /**
     * 新增
     * @param account
     * @return
     */
    @PostMapping("account")
    CommonResult insert(@RequestBody AccountDto account);

    /**
     * 修改
     * @param account
     * @return
     */
    @PutMapping("account")
    CommonResult update(@RequestBody AccountDto account);

    /**
     * 删除
     * @param id
     * @return
     */
    @DeleteMapping("/account/{id}")
    CommonResult delete(@PathVariable(value = "id") Long id);

    /**
     * 获取一个
     * @param id
     * @return
     */
    @GetMapping("/account/{id}")
    CommonResult getOne(@PathVariable(value = "id") Long id);

    /**
     * 减账户
     * @param account
     * @return
     */
    @PostMapping("/account/reduce")
    CommonResult reduce(@RequestBody AccountDto account);
}
